#include "atomic_0822_transmission_control_service.h"


int getTransportControl(TransportInput *transportInput, TransportOutput *transportOutput) {
    // 检查输入输出指针是否为空
    if (transportInput == nullptr || transportOutput == nullptr) {
        return ATOMIC_SERVICE_ERROR;
    }

    // 模拟传输控制逻辑（实际场景需根据业务实现）
    // 这里简单将输入的端口信息等映射到输出结果
    transportOutput->transfer_result = (transportInput->src_port > 0 && transportInput->dest_port > 0) ? 0 : 1;
    transportOutput->actual_sent_len = (transportOutput->transfer_result == 0) ? transportInput->data_len : 0;
    // transportOutput->error_info = (transportOutput->transfer_result == 0) ? "success" : "invalid port";

    return ATOMIC_SERVICE_SUCCESS;
}
